/* Use ltgen */

#ifndef SRC_LTERR_H_
#define SRC_LTERR_H_

#include <stdbool.h>
#include <stdint.h>
#include "src/ltbase.h"

/** 错误代码，0表示正确。*/
typedef enum {
    /* ltgen lterr_IO_Error */
    lterr_kOk,
    lterr_kEnd,
    lterr_kFileError,
    lterr_kZeroBuf,
    lterr_kError,
    /* ltgen_End */
} lterr_Code;

typedef struct {
    char const* name;
    char const* description;
} lterr_ErrorInfo;

extern lterr_ErrorInfo lterr_gErrorInfos[];

lt_ForceInline char const*
lterr_Name(lterr_Code code) {
    return lterr_gErrorInfos[code].description;
}

#endif
